home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / pmake / lst / lstEnQueue.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-19  |  1.3 KB  |  48 lines

  1. /*-
  2.  * LstEnQueue.c--
  3.  *    Treat the list as a queue and place a datum at its end
  4.  *
  5.  * Copyright (c) 1988 by University of California Regents
  6.  *
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appears in all copies.  Neither the University of California nor
  11.  * Adam de Boor makes any representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  */
  15. #ifndef lint
  16. static char *rcsid =
  17. "$Id: lstEnQueue.c,v 1.4 88/11/17 20:52:26 adam Exp $ SPRITE (Berkeley)";
  18. #endif lint
  19.  
  20. #include    "lstInt.h"
  21.  
  22. /*-
  23.  *-----------------------------------------------------------------------
  24.  * Lst_EnQueue --
  25.  *    Add the datum to the tail of the given list.
  26.  *
  27.  * Results:
  28.  *    SUCCESS or FAILURE as returned by Lst_Append.
  29.  *
  30.  * Side Effects:
  31.  *    the lastPtr field is altered all the time and the firstPtr field
  32.  *    will be altered if the list used to be empty.
  33.  *
  34.  *-----------------------------------------------------------------------
  35.  */
  36. ReturnStatus
  37. Lst_EnQueue (l, d)
  38.     Lst              l;
  39.     ClientData      d;
  40. {
  41.     if (LstValid (l) == FALSE) {
  42.     return (FAILURE);
  43.     }
  44.     
  45.     return (Lst_Append (l, Lst_Last(l), d));
  46. }
  47.  
  48.